package com.blacktea.behavioralpatterns.visitorpattern;

import java.util.ArrayList;
import java.util.List;

/**
 * @description: 订单结构类
 * @author: black tea
 * @date: 2023/3/26 22:47
 */
public class OrderStructure {

    private final List<OrderItem> items = new ArrayList<>();

    public void addItem(OrderItem item) {
        items.add(item);
    }

    public void accept(OrderVisitor visitor) {
        for (OrderItem item : items) {
            item.accept(visitor);
        }
    }
}
